import React from 'react';
import { SchemaManageAPI } from '../../type';

import { SearchInput } from './SearchInput';
import { SearchSelect } from './SearchSelect';
import { SearchRangePicker } from './SearchRangePicker';
import { SearchTagSelect } from './SearchTagSelect';
import { SearchTreeSelect } from './SearchTreeSelect';
import { SearchDeptAndUserSelect } from './SearchDeptAndUserSelect';
import { SearchInputNumber } from './SearchInputNumber';
import { SearchTreeCompanySelect } from './SearchTreeCompanySelect';
import { SearchCascader } from './SearchCascader';
import { SearchNumberRanage } from './SearchNumberRanage';
import { SearchBigModal } from './SearchBigModal';
import { SearchRangePickerCheck } from './SearchRangePickerCheck';
import { SearchDatePicker } from './SearchDatePicker';

interface IPropsType {
  id?: string;
  value?: any;
  onChange?: any;
  opt: SchemaManageAPI.ISearchList;
  type: string;
  visible?: boolean;
  dateType?: string;
}

export const SearchComponent: React.FC<IPropsType> = (props) => {
  switch (props?.type) {
    case 'Input':
      return <SearchInput {...props} />;
    case 'Select':
      return <SearchSelect {...props} />;
    case 'DatePicker':
      return <SearchDatePicker {...props} />;
    case 'RangePicker':
      return <SearchRangePicker {...props} />;
    case 'TagSelect':
      return <SearchTagSelect {...props} />;
    case 'TreeSelect':
      return <SearchTreeSelect {...props} />;
    case 'DeptAndUser':
      return <SearchDeptAndUserSelect {...props} />;
    case 'InputNumber':
      return <SearchInputNumber {...props} />;
    case 'TreeCompanySelect':
      return <SearchTreeCompanySelect {...props} />;
    case 'Cascader':
      return <SearchCascader {...props} />;
    case 'NumberRange':
      return <SearchNumberRanage {...props} />;
    case 'SearchBigModal':
      return <SearchBigModal {...props} />;
    case 'RangePickerCheck':
      return <SearchRangePickerCheck {...props} />;
    default:
      return <></>;
  }
};
